package com.Ajava1704.for线程池2;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * 作者: LCG
 * 日期: 2020/2/11 09:26
 * 描述: //创建一个单一的线程池
 */
public class ForPoolTest2 {

    public static void main(String[] args) {

        ExecutorService executorService = Executors.newSingleThreadExecutor();//创建一个单一的线程池

        for(int i=0;i<5;i++){
            final int h=i;
            Runnable runnable = new Runnable() {
                @Override
                public void run() {
                    for(int j=0;j<5;j++){
                        System.out.println(h+"==========="+j);
                    }
                }
            };

            executorService.submit(runnable);
        }

    }

}
